package io.datajek.springbasics.movierecommendersystem.lesson10;
import io.datajek.springbasics.movierecommendersystem.lesson9.Filter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
//@Primary
//@Qualifier("CBF")
public abstract class ContentBasedFilter implements Filter {
	//用于计数创建的实例
	private static int instances= 0;

	@Autowired
	private Movie movie;

	public ContentBasedFilter(Movie movie) {
		super();
		instances++;
		this.movie = movie;
		System.out.println("ContentBasedFilter constructor called");
	}

	public Movie getMovie() {
		return movie;
	}

	public static int getInstances(){
		return ContentBasedFilter.instances;
	}

	//getRecommendations将一部电影作为输入，并返回类似电影的列表。
	public String[] getRecommendations(String movie) {
		//计算电影之间的相似度
		//返回电影推荐
		return new String[] {"Happy Feet", "Ice Age", "Shark Tale"};
	}
}
